package org.nepu.scr.indexrate.converter.longevityrate;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.longevityrate.CommonI;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class CommonIConverter implements AttributeConverter<CommonI, String> {
    @Override
    public String convertToDatabaseColumn(CommonI commonI) {
        return JSONUtil.toJsonStr(commonI);
    }

    @Override
    public CommonI convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, CommonI.class);
    }
}
